<? include("/inc/header.html") {} ?>

<div class="col-lg-12">
	<div class="panel panel" style="padding-top:5%;">
		<div class="panel-body pan" style="height: 333px">
			<div class="form-body pal">
				<div>
					<label for="inputUsername" class="col-md-3 control-label">部门名称<span
						class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-icon">
							<input id="name" type="text" class="form-control" />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">部门描述
						<span class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-icon">
							<input id="description" type="text" class="form-control" />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">父节点<span
						class='require'>*</span> </label>
					<div class="col-md-9">
						<div class="input-group input-group-sm mbs">
							<input id="parentclassname" type="text" class="form-control" disabled="true" /> 
							<span class="input-group-btn">
							<button onclick="saveclassZTree()" type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle">选择...</button>
							</span> 
							<input id="parentClassid" type="hidden" value="00" class="form-control" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	//选择父类
		function saveclassZTree() {
		layer.open({
			type : 2,
			area : [ '360px', '400px' ],
			fix : false, //不固定
			scrollbar : false,
			shadeClose : true,
			move : false,
			title:"选择父节点",
			skin : 'layui-layer-rim', //加上边框
			btn : [ '保存 ', '关闭' ],
			content : ["knowledge-edit-data-department-zTree.html", 'no'],
			yes : function(index,layer) {		
			  var iframeWin = parent.window[window.name].window[layer.find('iframe')[0]['name']];
			  			  iframeWin.save();
			},
			cancel : function(index) {
			}
		});
	}
	
	function save() {   
		$.ajax({
			type : "post",
			url : "knowledgeEditDataAddDepartment.do",
			dataType : "json",
			data:{
				"name":$("#name").val(),
				"description":$("#description").val(),
				"parentClassid":$("#parentClassid").val()
			},
			beforeSend : function(XMLHttpRequest) {},
			success: function padlock() {  
           		 var index = parent.layer.getFrameIndex(window.name); 
           		 parent.layer.msg('添加或编辑成功');
            	 parent.layer.close(index); 
    		}
			});
    } 
</script>
